/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package sda.levelup.frames;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.net.InetAddress;
import javax.swing.JPanel;

/**
 *
 * @author user
 */
public class PaintIP extends JPanel
{

    @Override
    public void paintComponent(Graphics g)
    {
        super.paintComponent(g);
        Graphics2D g2d = (Graphics2D) g;
        g2d.setColor(Color.GREEN);
        g2d.drawString(getIP(), 10, 10);
    }

    public String getIP()
    {
        String IP = "";
        try
        {
            IP = InetAddress.getLocalHost().getHostAddress();
        }
        catch (Exception e)
        {
            IP = "Error finding IP";
        }
        return IP;
    }
}
